#pragma once

#include "Common/MessageDispatch/MessageDispatch.h"

class LoginLoginModule : public IClientMessageHandler,
					public IServerMessageHandler,
					public IDBProxyMessageHandler
{
public:
	bool Init();
	void UnInit();
	/////////////////////////////  IClientMessageHandler /////////////////////////////////////////////
	virtual void		onClientMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getClientHandlerDebugInfo(void) { return "LoginModule::onClientMessage"; }
	//////////////////////////////  IServerMessageHandler ////////////////////////////////////////////
	virtual void		onServerMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getServerHandlerDebugInfo(void){ return "LoginModule::onServerMessage"; }
	//////////////////////////////// IDBProxyMessageHandler //////////////////////////////////////////	
	virtual void		onDBProxyMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getDBProxyHandlerDebugInfo(void){ return "LoginModule::onServerMessage"; }

private:
	//请求账号登录
	bool AccountLoginReq(RECV_PACKAGE &package);
private:
	//账号登录DB返回
	bool DBRet_AccountLoginRsp(RECV_PACKAGE &package);
private:
	//账号登录中心服验证返回
	bool CenterToLoginCheckRsp(RECV_PACKAGE &package);
	//中心服通知登录服账号下线
	bool CenterToLoginNotifyLogout(RECV_PACKAGE &package);
public:
	LoginLoginModule();
	virtual ~LoginLoginModule();
};